<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>玩家列表</title>
    <link href="/majiang/Public/admin/css/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/majiang/Public/admin/js/jquery.js"></script>

    <script type="text/javascript" src="/majiang/Public/layer/layer.js"></script>

    <link href="/majiang/Public/admin/css/select.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/majiang/Public/admin/js/jquery.idTabs.min.js"></script>
    <script type="text/javascript" src="/majiang/Public/admin/js/select-ui.min.js"></script>
     <script type="text/javascript" src="/majiang/Public/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript">
			$(document).ready(function(e) {
				$("#daili").uedSelect({
					width : 100		  
				});
			});
				$(document).ready(function(e) {
				$("#zaixian").uedSelect({
					width : 100		  
				});
			});
				$(document).ready(function(e) {
				$("#level").uedSelect({
					width : 100		  
				});
			});
     </script>
	
    </head>
    <body>
        <div class="place">
            <span>位置：</span>
            <ul class="placeul">
                <li><a href="<?php echo U('index/welcome');?>">首页</a></li>
                <li><a href="<?php echo U('userinfo/index');?>">玩家列表</a></li>
            </ul>
        </div>

        <div class="formbody"> 
            <form name="seachform" id="seachform" action="<?php echo U('userinfo/index');?>" method="post">
                <ul class="seachform">
                    <li><label></label><input placeholder="玩家" name="nickname" style="width: 100px;" value="<?php echo ($nickname); ?>" type="text" class="scinput" /></li>	
                   <li><label>关注时间</label>
					<input name="starttime" id="starttime" class="dfinput" type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{ $dp.$D(\'endtime\')||\'2100-10-01\' }'})" datatype="*" errormsg="时间范围开始值不能为空！" maxlength="20" style="width: 100px;" readonly value="<?php echo ($starttime); ?>" />-
					<input name="endtime" id="endtime" class="dfinput" type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{ $dp.$D(\'starttime\') }',maxDate:'2100-10-01'})" datatype="*" errormsg="时间范围结束值范围不能为空！" maxlength="20" style="width: 100px;" readonly value="<?php echo ($endtime); ?>" />
					<i class="Validform_checktip"></i></li>
              		<li><label>代理</label>
					<div class="vocation">
						<select id="daili" name="daili">
							<option value="">请选择</option>
							<?php if(is_array($dailiinfo)): $i = 0; $__LIST__ = $dailiinfo;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><option value="<?php echo ($key); ?>" <?php if(($key == $daili) and ($daili != '') ): ?>selected<?php endif; ?>><?php echo ($data); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
						</select>
					</div>
				    </li>
					<li><label></label>
					<div class="vocation">
						<select id="zaixian" name="zaixian">
							<option value="">在线状态</option>
							<?php if(is_array($onlinetype)): $i = 0; $__LIST__ = $onlinetype;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><option value="<?php echo ($key); ?>" <?php if(($key == $zaixian) and ($zaixian != '') ): ?>selected<?php endif; ?>><?php echo ($data); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
						</select>
					</div>
				     </li>
					 <li><label></label>
					<div class="vocation">
						<select id="level" name="level">
							<option value="">请选择级别</option>
							<?php if(is_array($agentlevel)): $i = 0; $__LIST__ = $agentlevel;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><option value="<?php echo ($key); ?>" <?php if($key == $level ): ?>selected<?php endif; ?>><?php echo ($data); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
						</select>
					</div>
				</li>
                    <li><label>&nbsp;</label><input name="" type="submit" class="scbtn" value="查询"/></li>
                </ul>
            </form>

            <table class="tablelist">
                <thead>
                    <tr> 
					    <th>玩家ID</th>
                        <th>昵称</th>
                        <th>推荐人</th>
					    <th>关注时间</th>
                        <th>在线状态</th>
						<th>是否代理</th>
						<th>级别</th>
                        <th>操作人</th>
						<th>佣金比例</th>
                        <th>账户余额</th>
						<th>剩余天数</th>
						<th>操作</th>
                    </tr>
                </thead>
                <tbody>
				 <?php if(is_array($dataList)): $i = 0; $__LIST__ = $dataList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$value): $mod = ($i % 2 );++$i;?><tr>	
                        <td><?php echo ($value['game_userid']); ?></td> 					
						<td><?php echo ($value['nickname']); ?></td> 
						<td><?php echo ($value['name']); ?></td> 
						<td><?php echo (date("Y-m-d H:i:s",$value['addtime'])); ?></td> 
						<td><?php echo ($onlinetype[$value['online']]); ?></td> 
						<td><?php echo ($dailiinfo[$value['isagent']]); ?></td> 
						<td><?php echo ($agentlevel[$value['agentlevel']]); ?></td> 
						<td><?php echo ($value['username']); ?></td> 
						<td><?php echo ($value['moneyrate']); ?></td> 
						<td><?php echo ($value['money']); ?></td>
						<td><?php echo ($value["gameendtime"]); ?></td>
                        <td>
							<?php if($value["employee"] != 2): ?><a href="<?php echo U('userinfo/setemployee',array('user_id'=>$value['user_id']));?>" onclick="{if(confirm('确认设为员工吗?')){return true;}return false;}" class="tablelink">设为员工</a>
							<?php else: ?>
							<font style="color:red;">员工</font><?php endif; ?>
                            <a style="color:black" href="<?php echo U('userinfo/deluser',array('id'=>$value['user_id']));?>" onclick="{if(confirm('确认删除?')){return true;}return false;}" class="tablelink">删除</a>
                            <a href='javascript:userlevel(<?php echo ($value['user_id']); ?>,"<?php echo ($value["nickname"]); ?>",<?php echo ($value['agentlevel']); ?>);' style="cursor:pointer;">设置等级</a>
                            </td>
                        </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                </tbody>
            </table>

            <?php echo ($pageshow); ?>

        </div>
        <script type="text/javascript">
            //改变列表tr的背景色
            $('.tablelist tbody tr:odd').addClass('odd');
            //设置等级弹窗
            function userlevel(user_id,nickname,level){
                layer.open({
                    type: 2,
                    title: '设置['+nickname+']等级',
                    maxmin: true,
                    shadeClose: true, //点击遮罩关闭层
                    area : ['800px' , '520px'],
                    content: "<?php echo U('userinfo/set_userlevel');?>&user_id="+user_id+"&agentlevel="+level
                });
            }
        </script>
    </body>

</html>